package br.com.toscano.gobra.view;

import javax.inject.Inject;

import br.com.toscano.gobra.business.TipoARTBC;
import br.com.toscano.gobra.domain.TipoART;
import br.gov.frameworkdemoiselle.annotation.PreviousView;
import br.gov.frameworkdemoiselle.stereotype.ViewController;
import br.gov.frameworkdemoiselle.template.AbstractEditPageBean;
import br.gov.frameworkdemoiselle.transaction.Transactional;

@ViewController
@PreviousView("./tipoART_list.jsf")
public class TipoARTEditMB extends AbstractEditPageBean<TipoART, Long> {

	private static final long serialVersionUID = 1L;

	@Inject
	private TipoARTBC tipoARTBC;
	
	@Override
	@Transactional
	public String delete() {
		this.tipoARTBC.delete(getId());
		return getPreviousView();
	}
	
	@Override
	@Transactional
	public String insert() {
		this.tipoARTBC.insert(getBean());
		return getPreviousView();
	}
	
	@Override
	@Transactional
	public String update() {
		this.tipoARTBC.update(getBean());
		return getPreviousView();
	}

	@Override
	protected TipoART handleLoad(Long id) {
		setBean(this.tipoARTBC.load(id));
		return getBean();
	}

}